package c.a.a.z.b;

import android.graphics.Path;
import android.graphics.PointF;
import c.a.a.b0.e;
import c.a.a.b0.k.i;
import c.a.a.b0.k.i.a;
import c.a.a.b0.k.q;
import c.a.a.e0.f;
import c.a.a.f0.c;
import c.a.a.l;
import c.a.a.z.c.a.b;
import java.util.List;

/* compiled from: PolystarContent */
public class n implements m, b, k {
    public final Path a = new Path();
    public final String b;
    public final l c;
    public final a d;
    public final boolean e;
    public final c.a.a.z.c.a<?, Float> f;
    public final c.a.a.z.c.a<?, PointF> g;
    public final c.a.a.z.c.a<?, Float> h;
    public final c.a.a.z.c.a<?, Float> i;
    public final c.a.a.z.c.a<?, Float> j;
    public final c.a.a.z.c.a<?, Float> k;
    public final c.a.a.z.c.a<?, Float> l;
    public b m = new b();
    public boolean n;

    public n(l lVar, c.a.a.b0.l.b bVar, i iVar) {
        this.c = lVar;
        this.b = iVar.a;
        a aVar = iVar.b;
        this.d = aVar;
        this.e = iVar.j;
        c.a.a.z.c.a a = iVar.c.a();
        this.f = a;
        c.a.a.z.c.a a2 = iVar.d.a();
        this.g = a2;
        c.a.a.z.c.a a3 = iVar.e.a();
        this.h = a3;
        c.a.a.z.c.a a4 = iVar.g.a();
        this.j = a4;
        c.a.a.z.c.a a5 = iVar.i.a();
        this.l = a5;
        a aVar2 = a.STAR;
        if (aVar == aVar2) {
            this.i = iVar.f.a();
            this.k = iVar.h.a();
        } else {
            this.i = null;
            this.k = null;
        }
        bVar.e(a);
        bVar.e(a2);
        bVar.e(a3);
        bVar.e(a4);
        bVar.e(a5);
        if (aVar == aVar2) {
            bVar.e(this.i);
            bVar.e(this.k);
        }
        a.a.add(this);
        a2.a.add(this);
        a3.a.add(this);
        a4.a.add(this);
        a5.a.add(this);
        if (aVar == aVar2) {
            this.i.a.add(this);
            this.k.a.add(this);
        }
    }

    public String a() {
        return this.b;
    }

    public void c() {
        this.n = false;
        this.c.invalidateSelf();
    }

    public void d(List<c> list, List<c> list2) {
        for (int i = 0; i < list.size(); i++) {
            c cVar = (c) list.get(i);
            if (cVar instanceof s) {
                s sVar = (s) cVar;
                if (sVar.c == q.a.SIMULTANEOUSLY) {
                    this.m.a.add(sVar);
                    sVar.b.add(this);
                }
            }
        }
    }

    public void f(e eVar, int i, List<e> list, e eVar2) {
        f.f(eVar, i, list, eVar2, this);
    }

    public Path h() {
        if (this.n) {
            return this.a;
        }
        this.a.reset();
        if (this.e) {
            this.n = true;
            return this.a;
        }
        int ordinal = this.d.ordinal();
        double d = 0.0d;
        float floatValue;
        c.a.a.z.c.a aVar;
        double toRadians;
        float f;
        float floatValue2;
        float floatValue3;
        float a;
        double d2;
        double d3;
        float sin;
        PointF pointF;
        if (ordinal == 0) {
            float f2;
            float f3;
            floatValue = ((Float) this.f.e()).floatValue();
            aVar = this.h;
            if (aVar != null) {
                d = (double) ((Float) aVar.e()).floatValue();
            }
            toRadians = Math.toRadians(d - 90.0d);
            d = (double) floatValue;
            float f4 = (float) (6.283185307179586d / d);
            f = f4 / 2.0f;
            floatValue -= (float) ((int) floatValue);
            int i = (floatValue > 0.0f ? 1 : (floatValue == 0.0f ? 0 : -1));
            if (i != 0) {
                toRadians += (double) ((1.0f - floatValue) * f);
            }
            floatValue2 = ((Float) this.j.e()).floatValue();
            floatValue3 = ((Float) this.i.e()).floatValue();
            c.a.a.z.c.a aVar2 = this.k;
            float floatValue4 = aVar2 != null ? ((Float) aVar2.e()).floatValue() / 100.0f : 0.0f;
            c.a.a.z.c.a aVar3 = this.l;
            float floatValue5 = aVar3 != null ? ((Float) aVar3.e()).floatValue() / 100.0f : 0.0f;
            if (i != 0) {
                a = c.b.a.a.a.a(floatValue2, floatValue3, floatValue, floatValue3);
                double d4 = (double) a;
                f2 = floatValue3;
                f3 = floatValue4;
                floatValue3 = (float) (Math.cos(toRadians) * d4);
                floatValue4 = (float) (d4 * Math.sin(toRadians));
                this.a.moveTo(floatValue3, floatValue4);
                toRadians += (double) ((f4 * floatValue) / 2.0f);
            } else {
                f2 = floatValue3;
                f3 = floatValue4;
                double d5 = (double) floatValue2;
                a = (float) (Math.cos(toRadians) * d5);
                floatValue4 = (float) (Math.sin(toRadians) * d5);
                this.a.moveTo(a, floatValue4);
                toRadians += (double) f;
                floatValue3 = a;
                a = 0.0f;
            }
            d = Math.ceil(d) * 2.0d;
            float f5 = f;
            int i2 = i;
            int i3 = 0;
            int i4 = 0;
            while (true) {
                double d6 = (double) i3;
                if (d6 >= d) {
                    break;
                }
                float f6;
                float f7;
                float f8;
                float f9;
                float f10 = i4 != 0 ? floatValue2 : f2;
                int i5 = (a > 0.0f ? 1 : (a == 0.0f ? 0 : -1));
                if (i5 == 0 || d6 != d - 2.0d) {
                    f6 = f4;
                    f4 = f5;
                } else {
                    f6 = f4;
                    f4 = (f4 * floatValue) / 2.0f;
                }
                if (i5 == 0 || d6 != d - 1.0d) {
                    f7 = a;
                    a = f10;
                    f10 = f4;
                } else {
                    f10 = f4;
                    f7 = a;
                }
                double d7 = (double) a;
                d2 = d6;
                f = (float) (Math.cos(toRadians) * d7);
                f4 = (float) (d7 * Math.sin(toRadians));
                if (f3 == 0.0f && floatValue5 == 0.0f) {
                    this.a.lineTo(f, f4);
                    f8 = f4;
                    d3 = toRadians;
                    f9 = floatValue5;
                } else {
                    d3 = toRadians;
                    float f11 = floatValue4;
                    a = floatValue5;
                    double atan2 = (double) ((float) (Math.atan2((double) floatValue4, (double) floatValue3) - 1.5707963267948966d));
                    floatValue4 = (float) Math.cos(atan2);
                    sin = (float) Math.sin(atan2);
                    floatValue5 = f11;
                    f8 = f4;
                    f9 = a;
                    d7 = (double) ((float) (Math.atan2((double) f4, (double) f) - 1.5707963267948966d));
                    float cos = (float) Math.cos(d7);
                    f4 = (float) Math.sin(d7);
                    a = i4 != 0 ? f3 : f9;
                    float f12 = ((i4 != 0 ? f2 : floatValue2) * a) * 0.47829f;
                    floatValue4 *= f12;
                    f12 *= sin;
                    float f13 = ((i4 != 0 ? floatValue2 : f2) * (i4 != 0 ? f9 : f3)) * 0.47829f;
                    cos *= f13;
                    f13 *= f4;
                    if (i2 != 0) {
                        if (i3 == 0) {
                            floatValue4 *= floatValue;
                            f12 *= floatValue;
                        } else if (d2 == d - 1.0d) {
                            cos *= floatValue;
                            f13 *= floatValue;
                        }
                    }
                    this.a.cubicTo(floatValue3 - floatValue4, floatValue5 - f12, f + cos, f8 + f13, f, f8);
                }
                toRadians = d3 + ((double) f10);
                i4 ^= 1;
                i3++;
                floatValue3 = f;
                a = f7;
                f4 = f6;
                floatValue4 = f8;
                floatValue5 = f9;
            }
            pointF = (PointF) this.g.e();
            this.a.offset(pointF.x, pointF.y);
            this.a.close();
        } else if (ordinal == 1) {
            ordinal = (int) Math.floor((double) ((Float) this.f.e()).floatValue());
            aVar = this.h;
            if (aVar != null) {
                d = (double) ((Float) aVar.e()).floatValue();
            }
            toRadians = Math.toRadians(d - 90.0d);
            double d8 = (double) ordinal;
            f = (float) (6.283185307179586d / d8);
            sin = ((Float) this.l.e()).floatValue() / 100.0f;
            a = ((Float) this.j.e()).floatValue();
            d = (double) a;
            floatValue2 = (float) (Math.cos(toRadians) * d);
            floatValue3 = (float) (Math.sin(toRadians) * d);
            this.a.moveTo(floatValue2, floatValue3);
            double d9 = (double) f;
            toRadians += d9;
            d8 = Math.ceil(d8);
            int i6 = 0;
            while (((double) i6) < d8) {
                double d10;
                float cos2 = (float) (Math.cos(toRadians) * d);
                double d11 = d8;
                floatValue = (float) (Math.sin(toRadians) * d);
                if (sin != 0.0f) {
                    d10 = d;
                    d3 = toRadians;
                    toRadians = (double) ((float) (Math.atan2((double) floatValue3, (double) floatValue2) - 1.5707963267948966d));
                    d2 = d9;
                    double atan22 = (double) ((float) (Math.atan2((double) floatValue, (double) cos2) - 1.5707963267948966d));
                    float f14 = (a * sin) * 0.25f;
                    this.a.cubicTo(floatValue2 - (((float) Math.cos(toRadians)) * f14), floatValue3 - (((float) Math.sin(toRadians)) * f14), cos2 + (((float) Math.cos(atan22)) * f14), floatValue + (f14 * ((float) Math.sin(atan22))), cos2, floatValue);
                } else {
                    d3 = toRadians;
                    d10 = d;
                    d2 = d9;
                    this.a.lineTo(cos2, floatValue);
                }
                toRadians = d3 + d2;
                i6++;
                floatValue3 = floatValue;
                floatValue2 = cos2;
                d8 = d11;
                d = d10;
                d9 = d2;
            }
            pointF = (PointF) this.g.e();
            this.a.offset(pointF.x, pointF.y);
            this.a.close();
        }
        this.a.close();
        this.m.a(this.a);
        this.n = true;
        return this.a;
    }

    public <T> void i(T t, c<T> cVar) {
        c.a.a.z.c.a aVar;
        c cVar2;
        if (t == c.a.a.q.s) {
            aVar = this.f;
            cVar2 = aVar.e;
            aVar.e = cVar;
        } else if (t == c.a.a.q.t) {
            aVar = this.h;
            cVar2 = aVar.e;
            aVar.e = cVar;
        } else if (t == c.a.a.q.j) {
            aVar = this.g;
            cVar2 = aVar.e;
            aVar.e = cVar;
        } else {
            c.a.a.z.c.a aVar2;
            c cVar3;
            if (t == c.a.a.q.u) {
                aVar2 = this.i;
                if (aVar2 != null) {
                    cVar3 = aVar2.e;
                    aVar2.e = cVar;
                    return;
                }
            }
            if (t == c.a.a.q.v) {
                aVar = this.j;
                cVar2 = aVar.e;
                aVar.e = cVar;
                return;
            }
            if (t == c.a.a.q.w) {
                aVar2 = this.k;
                if (aVar2 != null) {
                    cVar3 = aVar2.e;
                    aVar2.e = cVar;
                    return;
                }
            }
            if (t == c.a.a.q.x) {
                aVar = this.l;
                cVar2 = aVar.e;
                aVar.e = cVar;
            }
        }
    }
}
